package com.itheima.string;

import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        //已知用户名和密码
        String userName = "admin";
        String passWorld = "123456";


        Scanner sc = new Scanner(System.in);

        for (int i = 1; i <= 3;i++){
            //键盘录入两个数据
            System.out.println("请输入用户名");
            String name = sc.next();
            System.out.println("请输入密码");
            String pass = sc.next();

            if (userName.equals(name)&&passWorld.equals(pass)){
                System.out.println("登录成功");
            }else{if(i == 3){
                System.out.println("机会已用完");
            }else{
                System.out.println("登录失败,您还剩余"+(3-i)+"次机会");
            }


        }
      }


    }




}
